package threads.demo01;

import java.util.concurrent.locks.LockSupport;

public class LockSupportDemo {
    public static void main(String[] args) throws InterruptedException {
        MyTeread2 thread = new MyTeread2();
        thread.start();
        Thread.sleep(3000);

        LockSupport.unpark(thread);
        System.out.println("main end");
    }
}


class MyTeread2 extends Thread {
    private long i;

    @Override
    public void run() {
        while (i < 2000) {
            i++;

            if (i == 1000) {
                System.out.println("LockSupport.park()");
                LockSupport.park();
            }
            System.out.println(i);
        }
    }
}